import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite';
import Components from 'unplugin-vue-components/vite';
import { VantResolver } from '@vant/auto-import-resolver';

// https://vite.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    AutoImport({
      resolvers: [VantResolver()],
    }),
    Components({
      resolvers: [VantResolver()],
    }),
  ],
  host: '0.0.0.0',
  server: {
    proxy: {
      // 代理规则
      // '/proxy': {
      //   target: 'https://scriptecho.cn',  // 目标服务器
      //   changeOrigin: true,             // 修改请求头中的origin
      //   rewrite: (path) => path.replace(/^\/proxy/, ''), // 路径重写
      //   secure: false                   // 禁用SSL验证（如需要）
      // }
    }
  }
})
